Skip to content

Conversation

@Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Jul 8, 2025

WHAT

The following ABI methods have been added to the PaymentManager which can be access via litClient.getPaymentManager()

API Methods:

      delegatePayments,
      delegatePaymentsBatch,
      getPayers,
      getPayersAndRestrictions,
      getRestriction,
      getUsers,
      setRestriction,
      undelegatePayments,
      undelegatePaymentsBatch,

Read Methods (View Functions)

getPayersAndRestrictions(address[] memory users)Ï

  • Takes an array of user addresses as input
  • Returns two arrays: all payers for each user and their corresponding restrictions
  • Useful for getting complete delegation info for multiple users at once

getUsers(address payer)

  • Takes a payer address as input
  • Returns an array of all users that this payer is covering payments for
  • Shows who a specific payer is delegating payments to

getRestriction(address payer)

  • Takes a payer address as input
  • returns the restriction settings for that specific payer
  • Shows what limitations/rules apply to a payer's delegation

`getPayers(address user)§

  • Takes a user address as input
  • Returns an array of all payers who are covering payments for this user
  • Shows who is paying on behalf of a specific user

Write methods

delegatePayments(address user)

  • Allows the caller (msg.sender) to start paying for a specific user
  • Creates a two-way relationship: adds caller as payer for the user, and adds user to caller's list
  • Authorization is automatic since the payer themselves is making the transaction

undelegatePayments(address user)

  • Removes payment delegation for a specific user
  • Requires the caller to already be an authorized payer for that user
  • Removes the two-way relationship between payer and user

delegatePaymentsBatch(address[] memory users)

  • Same as delegatePayments but for multiple users at once
  • More efficient than calling delegatePayments multiple times
  • Creates delegation relationships for all users in the array

undelegatePaymentsBatch(address[] memory users)

  • Same as undelegatePayments but for multiple users at once
  • Checks authorization for each user before removing delegation
  • More efficient for removing multiple delegations

setRestriction(LibPaymentDelegationStorage.Restriction memory r)

  • Allows a payer to set restrictions on their payment delegations
  • The restriction applies to the caller (msg.sender)
  • Defines rules/limits for how the payer's delegations work

@Ansonhkg Ansonhkg changed the base branch from master to feat/naga-dev-29-05-2025-v2 July 8, 2025 13:32
@Ansonhkg Ansonhkg merged commit 113eaf7 into feat/naga-dev-29-05-2025-v2 Jul 8, 2025
1 of 4 checks passed
@Ansonhkg Ansonhkg deleted the feature/node-4571-payment-manager-doesnt-include-paymentdelegationfacet branch July 8, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants